using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace BMC.ARSystem
{
	[ClassInterface, Guid("6aa2632b-ee32-4052-96ef-3f5a0a8aa834"), ProgId("BMC.ARSystem.ExternalReference")]
	public class ExternalReference : Reference
	{
		private ArrayList _permittedGroups;
		private object _value;
		public ArrayList PermittedGroups
		{
			get
			{
				return this._permittedGroups;
			}
			set
			{
				this._permittedGroups = value;
			}
		}
		public object Value
		{
			get
			{
				return this._value;
			}
			set
			{
				this._value = value;
			}
		}
		private ExternalReference() : this(0)
		{
		}
		public ExternalReference(int refType) : this(refType, DBNull.Value)
		{
		}
		public ExternalReference(int refType, object val) : base(refType)
		{
			this.PermittedGroups = new ArrayList();
			this.Value = val;
			base.Name = "";
		}
		internal ExternalReference(object[] rawData, Server server) : base(rawData, server)
		{
			ARTypeMgr arg_34_0 = ARTypeMgr.Instance;
			Type arg_34_1 = Type.GetType("System.UInt32");
			int[] array = new int[3];
			array[0] = 3;
			array[1] = 1;
			this.PermittedGroups = arg_34_0.ArrayListFromVariant(arg_34_1, (object[])Util.GetAt(rawData, array), server);
			this.Value = Util.ConvertFromARValue((object[])Util.GetAt(rawData, new int[]
			{
				3,
				1,
				1
			}), false, false);
			base.Name = ((this.Value != null) ? this.Value.ToString() : "");
		}
		internal static object ToVariant(object given, Server server)
		{
			if (!(given is Reference))
			{
				return given;
			}
			object obj = Reference.ToVariant(given, server);
			return (object[])obj;
		}
		public override bool Equals(object obj)
		{
			ExternalReference externalReference = obj as ExternalReference;
			if (externalReference == null)
			{
				return false;
			}
			bool flag = Util.CompareArrayLists(this.PermittedGroups, externalReference.PermittedGroups);
			if (!flag)
			{
				return flag;
			}
			flag = (this.Value == externalReference.Value);
			if (!flag)
			{
				return flag;
			}
			return base.Equals(externalReference);
		}
		public override int GetHashCode()
		{
			if (this._value == null)
			{
				return 0;
			}
			return this._value.GetHashCode();
		}
	}
}
